package com.tea.common.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class R {
    private int code;
    private String msg;
    private Object data;

    /**
     * 成功*/
    public static R ok(String msg,Object data){
        return new R(0,msg,data);
    }
    /**
     * 成功*/
    public static R ok(Object data){
        return ok("OK",data);
    }
    /**
     * 成功*/
    public static R ok(){
        return ok("OK",null);
    }
    /**
     * 失败*/
    public static R fail(String msg,Object data){
        return new R(1,msg,data);
    }
    /**
     * 失败*/
    public static R fail(Object data){
        return ok("FAIL",data);
    }
    /**
     * 失败*/
    public static R fail(){
        return ok("FAIL",null);
    }
}
